package com.gs.cd.service.auth.eum;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/**
 * 默认角色编码
 * <p>
 * 弃用。采用角色管理方式来进行管理
 */
@Deprecated
public enum DefaultRoleEnum {
    TENANT_ADMIN("tenant_admin"),
    KG_ADMIN("kg_admin"), KG_OWNER("kg_owner"),
    KG_USER("kg_user"),
    SYS_ADMIN("sys_admin"),
    SYS_USER("sys_user"),
    NULL("");

    @EnumValue
    private final String name;


    DefaultRoleEnum(String name) {
        this.name = name;
    }

    @JsonValue
    public String getName() {
        return name;
    }

    @JsonCreator
    public static DefaultRoleEnum fromName(String name) {

        for (DefaultRoleEnum value : DefaultRoleEnum.values()) {
            if (value.getName().equals(name)) return value;
        }

        return DefaultRoleEnum.NULL;
    }
}
